#include "GY_TapeFinite.h"
//GY_TapeFinite
GY_TapeFinite::GY_TapeFinite(const QString &guid, QGraphicsItem *parent)
    : GY_ContainerTransform(guid,this, parent)
{
    initializationPropertyInfo();
    m_pTransFormGroup = new GY_TransformGroup(QString("%1_Group").arg(guid),this);
    m_ChildrensMap.insert(m_pTransFormGroup->getGuid(),m_pTransFormGroup);
    this->addToGroup(m_pTransFormGroup);
    this->setCenterPointF(m_PropertyInfoMap["Position"].propertyValue.toPointF());
    setContainerEditPointF();
    updateDraw();
}

GY_TapeFinite::~GY_TapeFinite()
{

}

void GY_TapeFinite::initializationPropertyInfo()
{
    GY_PropertyInfo ObjectName(this);
    ObjectName.propertyName = "ObjectName";
    ObjectName.propertyValue = QString();
    ObjectName.updateType = Update|OrdinaryAttributes;
    ObjectName.propertyType = QStringPropertyType;
    ObjectName.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updateObjectName;
    m_PropertyInfoMap.insert("ObjectName",ObjectName);
    m_PropertyInfoMap["ObjectName"].setConnect();
    //是否隐藏
    GY_PropertyInfo isVisible(this);
    isVisible.propertyName = "IsVisible";
    isVisible.propertyValue = true;
    isVisible.updateType = Update|OrdinaryAttributes;
    isVisible.propertyType = BoolPropertyType;
    isVisible.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updateIsVisible;
    m_PropertyInfoMap.insert("IsVisible",isVisible);
    m_PropertyInfoMap["IsVisible"].setConnect();
    //位置
    GY_PropertyInfo p_Position(this);
    p_Position.propertyName = "Position";
    p_Position.propertyValue = QPointF(0.0,0.0);
    p_Position.updateType = Update|MoveUpdate|PointOfRelative;
    p_Position.propertyType = PointPropertyType;
    p_Position.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updatePosition;
    m_PropertyInfoMap.insert("Position",p_Position);
    m_PropertyInfoMap["Position"].setConnect();

    GY_PropertyInfo p_Value(this);
    p_Value.propertyName = "Value";
    p_Value.propertyValue = qreal();
    p_Value.updateType = Update|OrdinaryAttributes;
    p_Value.propertyType = QrealPropertyType;
    p_Value.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updateValue;
    m_PropertyInfoMap.insert("Value",p_Value);
    m_PropertyInfoMap["Value"].setConnect();

    GY_PropertyInfo p_ValuePerRevolution(this);
    p_ValuePerRevolution.propertyName = "ValuePerRevolution";
    p_ValuePerRevolution.propertyValue = qreal();
    p_ValuePerRevolution.updateType = Update|OrdinaryAttributes;
    p_ValuePerRevolution.propertyType = QrealPropertyType;
    p_ValuePerRevolution.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updateValuePerRevolution;
    m_PropertyInfoMap.insert("ValuePerRevolution",p_ValuePerRevolution);
    m_PropertyInfoMap["ValuePerRevolution"].setConnect();
    //更新展示区域左边框位置
    GY_PropertyInfo p_DisplayAreaLeft(this);
    p_DisplayAreaLeft.propertyName = "DisplayArea.Left";
    p_DisplayAreaLeft.propertyValue = qreal(-60.0);
    p_DisplayAreaLeft.updateType = Update|OrdinaryAttributes;
    p_DisplayAreaLeft.propertyType = QrealPropertyType;
    p_DisplayAreaLeft.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updateDisplayAreaLeft;
    m_PropertyInfoMap.insert("DisplayArea.Left",p_DisplayAreaLeft);
    m_PropertyInfoMap["DisplayArea.Left"].setConnect();
    //更新展示区域底部边框位置
    GY_PropertyInfo p_DisplayAreaBottom(this);
    p_DisplayAreaBottom.propertyName = "DisplayArea.Bottom";
    p_DisplayAreaBottom.propertyValue = qreal(-30.0);
    p_DisplayAreaBottom.updateType = Update|OrdinaryAttributes;
    p_DisplayAreaBottom.propertyType = QrealPropertyType;
    p_DisplayAreaBottom.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updateDisplayAreaBottom;
    m_PropertyInfoMap.insert("DisplayArea.Bottom",p_DisplayAreaBottom);
    m_PropertyInfoMap["DisplayArea.Bottom"].setConnect();
    //更新展示区域右边框位置
    GY_PropertyInfo p_DisplayAreaRight(this);
    p_DisplayAreaRight.propertyName = "DisplayArea.Right";
    p_DisplayAreaRight.propertyValue = qreal(60.0);
    p_DisplayAreaRight.updateType = Update|OrdinaryAttributes;
    p_DisplayAreaRight.propertyType = QrealPropertyType;
    p_DisplayAreaRight.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updateDisplayAreaRight;
    m_PropertyInfoMap.insert("DisplayArea.Right",p_DisplayAreaRight);
    m_PropertyInfoMap["DisplayArea.Right"].setConnect();
    //更新展示区域顶部边框位置
    GY_PropertyInfo p_DisplayAreaTop(this);
    p_DisplayAreaTop.propertyName = "DisplayArea.Top";
    p_DisplayAreaTop.propertyValue = qreal(30.0);
    p_DisplayAreaTop.updateType = Update|OrdinaryAttributes;
    p_DisplayAreaTop.propertyType = QrealPropertyType;
    p_DisplayAreaTop.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updateDisplayAreaTop;
    m_PropertyInfoMap.insert("DisplayArea.Top",p_DisplayAreaTop);
    m_PropertyInfoMap["DisplayArea.Top"].setConnect();
    //运动方向的位置
    GY_PropertyInfo p_Motion(this);
    p_Motion.propertyName = "Motion";
    p_Motion.propertyValue = QPointF(120.0,0.0);
    p_Motion.updateType = Update|PointOfRelative;
    p_Motion.propertyType = PointPropertyType;
    p_Motion.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updateMotion;
    m_PropertyInfoMap.insert("Motion",p_Motion);
    m_PropertyInfoMap["Motion"].setConnect();
    /******************************************附加属性******************************************/
    //宽高拉伸点
    GY_PropertyInfo TopRightPoint(this);
    TopRightPoint.propertyName="TopRightPoint";
    TopRightPoint.propertyValue=QPointF(60.0,30.0);
    TopRightPoint.updateType = NotUpdate;
    TopRightPoint.propertyType = PointPropertyType;
    TopRightPoint.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updatePoint;
    m_PropertyInfoMap.insert(TopRightPoint.propertyName,TopRightPoint);
    m_PropertyInfoMap["TopRightPoint"].setConnect();
    //左拉伸点
    GY_PropertyInfo leftPoint(this);
    leftPoint.propertyName="LeftPoint";
    leftPoint.propertyValue=QPointF(-60.0,0.0);
    leftPoint.updateType = NotUpdate;
    leftPoint.propertyType = PointPropertyType;
    leftPoint.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updatePoint;
    m_PropertyInfoMap.insert(leftPoint.propertyName,leftPoint);
    m_PropertyInfoMap["LeftPoint"].setConnect();
    //右拉伸点
    GY_PropertyInfo rightPoint(this);
    rightPoint.propertyName="RightPoint";
    rightPoint.propertyValue=QPointF(60.0,0.0);
    rightPoint.updateType = NotUpdate;
    rightPoint.propertyType = PointPropertyType;
    rightPoint.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updatePoint;
    m_PropertyInfoMap.insert(rightPoint.propertyName,rightPoint);
    m_PropertyInfoMap["RightPoint"].setConnect();
    //上拉伸点
    GY_PropertyInfo topPoint(this);
    topPoint.propertyName="TopPoint";
    topPoint.propertyValue=QPointF(0.0,30.0);
    topPoint.updateType = NotUpdate;
    topPoint.propertyType = PointPropertyType;
    topPoint.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updatePoint;
    m_PropertyInfoMap.insert(topPoint.propertyName,topPoint);
    m_PropertyInfoMap["TopPoint"].setConnect();
    //下拉伸点
    GY_PropertyInfo bottomPoint(this);
    bottomPoint.propertyName="BottomPoint";
    bottomPoint.propertyValue=QPointF(0.0,-30.0);
    bottomPoint.updateType = NotUpdate;
    bottomPoint.propertyType = PointPropertyType;
    bottomPoint.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_TapeFinite::updatePoint;
    m_PropertyInfoMap.insert(bottomPoint.propertyName,bottomPoint);
    m_PropertyInfoMap["BottomPoint"].setConnect();
}

bool GY_TapeFinite::updateIsVisible(const QString &name, const QVariant &value)
{
    if(!value.canConvert<bool>())
    {
        return false;
    }
    m_PropertyInfoMap[name].propertyValue=value;
    this->setVisible(value.toBool());
    return true;
}

bool GY_TapeFinite::updatePosition(const QString &name, const QVariant &value)
{
    if(!value.canConvert<QPointF>())
    {
        return false;
    }
    m_PropertyInfoMap[name].propertyValue = this->mapFromScene(value.toPointF());
    updateDraw();
    //setpos设置为父级坐标
    QPointF point = value.toPointF();
    if(this->parentItem()) {
        point = this->mapToParent(this->mapFromScene(value.toPointF()));
    }
    this->setPos(point);
    return true;
}

bool GY_TapeFinite::updateValue(const QString &name, const QVariant &value)
{
    if(!value.canConvert<qreal>())
    {
        return false;
    }

    m_PropertyInfoMap[name].propertyValue=value;
    return true;
}

bool GY_TapeFinite::updateValuePerRevolution(const QString &name, const QVariant &value)
{
    if(!value.canConvert<qreal>())
    {
        return false;
    }

    m_PropertyInfoMap[name].propertyValue=value;
    return true;
}

bool GY_TapeFinite::updateDisplayAreaLeft(const QString &name, const QVariant &value)
{
    if(!value.canConvert<qreal>())
    {
        return false;
    }

    QPointF leftPoint = m_PropertyInfoMap["LeftPoint"].propertyValue.value<QPointF>();
    leftPoint.setX(value.toDouble());
    m_PropertyInfoMap["LeftPoint"].propertyValue = leftPoint;
    m_PropertyInfoMap[name].propertyValue = leftPoint.x();
    this->setEditPointF("LeftPoint",leftPoint);
    updateDraw();
    return true;
}

bool GY_TapeFinite::updateDisplayAreaBottom(const QString &name, const QVariant &value)
{
    if(!value.canConvert<qreal>())
    {
        return false;
    }

    QPointF bottomPoint = m_PropertyInfoMap["BottomPoint"].propertyValue.value<QPointF>();
    bottomPoint.setY(value.toDouble());
    m_PropertyInfoMap["BottomPoint"].propertyValue = bottomPoint;
    m_PropertyInfoMap[name].propertyValue = bottomPoint.y();
    this->setEditPointF("BottomPoint",bottomPoint);
    updateDraw();
    return true;
}

bool GY_TapeFinite::updateDisplayAreaRight(const QString &name, const QVariant &value)
{
    if(!value.canConvert<qreal>())
    {
        return false;
    }

    QPointF rightPoint = m_PropertyInfoMap["RightPoint"].propertyValue.value<QPointF>();
    rightPoint.setX(value.toDouble());
    m_PropertyInfoMap["RightPoint"].propertyValue = rightPoint;
    m_PropertyInfoMap[name].propertyValue = rightPoint.x();
    this->setEditPointF("RightPoint",rightPoint);
    updateDraw();
    return true;
}

bool GY_TapeFinite::updateDisplayAreaTop(const QString &name, const QVariant &value)
{
    if(!value.canConvert<qreal>())
    {
        return false;
    }

    QPointF topPoint = m_PropertyInfoMap["TopPoint"].propertyValue.value<QPointF>();
    QPointF topRightPoint = m_PropertyInfoMap["TopRightPoint"].propertyValue.value<QPointF>();
    topPoint.setY(value.toDouble());
    topRightPoint.setY(value.toDouble());
    m_PropertyInfoMap["TopPoint"].propertyValue = topPoint;
    m_PropertyInfoMap["TopRightPoint"].propertyValue = topRightPoint;
    m_PropertyInfoMap[name].propertyValue = topPoint.y();
    setContainerEditPointF();
    updateDraw();
    return true;
}

bool GY_TapeFinite::updateMotion(const QString &name, const QVariant &value)
{
    if(!value.canConvert<QPointF>())
    {
        return false;
    }
    QPointF mousePoint = this->mapFromScene(value.value<QPointF>());
    m_PropertyInfoMap[name].propertyValue=mousePoint;

    QPointF motionPoint = m_PropertyInfoMap["Motion"].propertyValue.value<QPointF>();
    //方向编辑点位置与鼠标位置同步
    if (name.endsWith("Motion"))
    {
        motionPoint=mousePoint;
        m_PropertyInfoMap["Motion"].propertyValue = motionPoint;
    }
    this->setEditPointF("Motion",motionPoint);
    //拖动编辑点可移动容器中的图形

    updateDraw();
    return true;
}

bool GY_TapeFinite::addItem(GY_Object *pItem)
{
    //若添加的单元为图形（item继承自GY_BasicsGraphicsObject）
    if(pItem->inherits("GY_BasicsGraphicsObject"))
    {
        this->addToGroup((GY_BasicsGraphicsObject *)pItem);
        m_ObjectItems.append(pItem);
    }
    //若添加的单元为容器（item继承自GY_ContainerTransform）
    else if(pItem->inherits("GY_ContainerTransform"))
    {
        this->addToGroup((GY_ContainerTransform *)pItem);
        m_ObjectItems.append(pItem);
    }
    //若不是上述两者
    else
    {
        return false;
    }
    //插入所添加的图形或容器的父级编号于子映射中
    m_ChildrensMap.insert(pItem->getGuid(),pItem);
    return true;
}

bool GY_TapeFinite::updatePoint(const QString &name, const QVariant &value)
{
    if(!value.canConvert<QPointF>())
    {
        return false;
    }
    QPointF mousePoint = this->mapFromScene(value.value<QPointF>());
    m_PropertyInfoMap[name].propertyValue = mousePoint;

    QPointF topRightPoint = m_PropertyInfoMap["TopRightPoint"].propertyValue.value<QPointF>();
    QPointF leftPoint = m_PropertyInfoMap["LeftPoint"].propertyValue.value<QPointF>();
    QPointF rightPoint = m_PropertyInfoMap["RightPoint"].propertyValue.value<QPointF>();
    QPointF topPoint = m_PropertyInfoMap["TopPoint"].propertyValue.value<QPointF>();
    QPointF bottomPoint = m_PropertyInfoMap["BottomPoint"].propertyValue.value<QPointF>();
    QPointF positionPoint = m_PropertyInfoMap["Position"].propertyValue.value<QPointF>();

    qreal leftDisplayArea = leftPoint.x();
    qreal bottomDisplayArea = bottomPoint.y();
    qreal rightDisplayArea = rightPoint.x();
    qreal topDisplayArea = topPoint.y();

    leftDisplayArea = m_PropertyInfoMap["DisplayArea.Left"].propertyValue.toDouble();
    bottomDisplayArea = m_PropertyInfoMap["DisplayArea.Bottom"].propertyValue.toDouble();
    rightDisplayArea = m_PropertyInfoMap["DisplayArea.Right"].propertyValue.toDouble();
    topDisplayArea = m_PropertyInfoMap["DisplayArea.Top"].propertyValue.toDouble();

    leftPoint.setX(leftDisplayArea);
    leftPoint.setY((topPoint.y()+bottomPoint.y())/2);

    bottomPoint.setX((leftPoint.x()+rightPoint.x())/2);
    bottomPoint.setY(bottomDisplayArea);

    rightPoint.setX(rightDisplayArea);
    rightPoint.setY((topPoint.y()+bottomPoint.y())/2);

    topPoint.setX((leftPoint.x()+rightPoint.x())/2);
    topPoint.setY(topDisplayArea);

    topRightPoint.setX(rightDisplayArea);
    topRightPoint.setY(topDisplayArea);

    if(name.endsWith("TopRightPoint"))
    {
        topRightPoint.setX(mousePoint.x());//60->58
        topRightPoint.setY(mousePoint.y());//30->32
        m_PropertyInfoMap["TopRightPoint"].propertyValue = topRightPoint;

        leftPoint.setY((mousePoint.y()+bottomPoint.y())/2);//0->16
        m_PropertyInfoMap["LeftPoint"].propertyValue = leftPoint;

        rightPoint.setX(topRightPoint.x());//0->58
        rightPoint.setY((mousePoint.y()+bottomPoint.y())/2);//15->16
        m_PropertyInfoMap["RightPoint"].propertyValue = rightPoint;

        topPoint.setX((rightPoint.x()+leftPoint.x())/2);//0->29
        topPoint.setY(topRightPoint.y());//0->32
        m_PropertyInfoMap["TopPoint"].propertyValue = topPoint;

        bottomPoint.setX(topPoint.x());//30->29
        m_PropertyInfoMap["BottomPoint"].propertyValue = bottomPoint;
    }
    else if (name.endsWith("LeftPoint"))//
    {
        leftPoint.setX(mousePoint.x());
        leftPoint.setY((topPoint.y()+bottomPoint.y())/2);
        m_PropertyInfoMap["LeftPoint"].propertyValue = leftPoint;

        topPoint.setX((mousePoint.x()+topRightPoint.x())/2);
        m_PropertyInfoMap["TopPoint"].propertyValue = topPoint;

        bottomPoint.setX((mousePoint.x()+topRightPoint.x())/2);
        m_PropertyInfoMap["BottomPoint"].propertyValue = bottomPoint;

        leftDisplayArea = mousePoint.x();
        m_PropertyInfoMap["DisplayArea.Left"].propertyValue = leftDisplayArea;
    }
    else if (name.endsWith("RightPoint"))//
    {
        rightPoint.setX(mousePoint.x());
        m_PropertyInfoMap["RightPoint"].propertyValue = rightPoint;

        topPoint.setX((mousePoint.x()+leftPoint.x())/2);
        m_PropertyInfoMap["TopPoint"].propertyValue = topPoint;

        bottomPoint.setX((mousePoint.x()+leftPoint.x())/2);
        m_PropertyInfoMap["BottomPoint"].propertyValue = bottomPoint;

        topRightPoint.setX(mousePoint.x());
        m_PropertyInfoMap["TopRightPoint"].propertyValue = topRightPoint;

        rightDisplayArea = mousePoint.x();
        m_PropertyInfoMap["DisplayArea.Right"].propertyValue = rightDisplayArea;

    }
    else if (name.endsWith("TopPoint"))//
    {
        topPoint.setY(mousePoint.y());
        m_PropertyInfoMap["TopPoint"].propertyValue = topPoint;

        leftPoint.setY((mousePoint.y()+bottomPoint.y())/2);
        m_PropertyInfoMap["LeftPoint"].propertyValue = leftPoint;

        rightPoint.setY((mousePoint.y()+bottomPoint.y())/2);
        m_PropertyInfoMap["RightPoint"].propertyValue = rightPoint;

        topRightPoint.setY(mousePoint.y());
        m_PropertyInfoMap["TopRightPoint"].propertyValue = topRightPoint;

        topDisplayArea = mousePoint.y();
        m_PropertyInfoMap["DisplayArea.Top"].propertyValue = topDisplayArea;
    }
    else if (name.endsWith("BottomPoint"))//
    {
        bottomPoint.setX((leftPoint.x()+rightPoint.x())/2);
        bottomPoint.setY(mousePoint.y());
        m_PropertyInfoMap["BottomPoint"].propertyValue = bottomPoint;

        leftPoint.setY((mousePoint.y()+topPoint.y())/2);
        m_PropertyInfoMap["LeftPoint"].propertyValue = leftPoint;

        rightPoint.setY((mousePoint.y()+topPoint.y())/2);
        m_PropertyInfoMap["RightPoint"].propertyValue = rightPoint;

        bottomDisplayArea = mousePoint.y();
        m_PropertyInfoMap["DisplayArea.Bottom"].propertyValue = bottomDisplayArea;
    }
    if (name.endsWith("DisplayArea.Left"))
    {
        leftPoint.setX(positionPoint.x()+leftDisplayArea);
        m_PropertyInfoMap["LeftPoint"].propertyValue=leftPoint;
    }
    else if (name.endsWith("DisplayArea.Bottom"))
    {
        bottomPoint.setX(positionPoint.y()+bottomDisplayArea);
        m_PropertyInfoMap["BottomPoint"].propertyValue=bottomPoint;
    }
    else if (name.endsWith("DisplayArea.Right"))
    {
        rightPoint.setX(positionPoint.x()+rightDisplayArea);
        m_PropertyInfoMap["RightPoint"].propertyValue=rightPoint;
    }
    else if (name.endsWith("DisplayArea.Top"))
    {
        topPoint.setX(positionPoint.x()+topDisplayArea);
        m_PropertyInfoMap["TopPoint"].propertyValue=topPoint;
    }

    updateDraw();
    QMap<QVariant,QPointF> editPoint =
    {
        {"TopRightPoint",topRightPoint},
        {"LeftPoint",leftPoint},
        {"BottomPoint",bottomPoint},
        {"RightPoint",rightPoint},
        {"TopPoint",topPoint},
    };

    this->setEditPointF(editPoint);

    return true;
}

void GY_TapeFinite::setContainerEditPointF()
{
    QPointF topRightPoint = m_PropertyInfoMap["TopRightPoint"].propertyValue.value<QPointF>();
    QPointF leftPoint = m_PropertyInfoMap["LeftPoint"].propertyValue.value<QPointF>();
    QPointF bottomPoint = m_PropertyInfoMap["BottomPoint"].propertyValue.value<QPointF>();
    QPointF rightPoint = m_PropertyInfoMap["RightPoint"].propertyValue.value<QPointF>();
    QPointF topPoint = m_PropertyInfoMap["TopPoint"].propertyValue.value<QPointF>();
    QPointF motionPoint = m_PropertyInfoMap["Motion"].propertyValue.value<QPointF>();

    QMap<QVariant,QPointF> editPoints =
    {
        {"TopRightPoint",topRightPoint},
        {"LeftPoint",leftPoint},
        {"BottomPoint",bottomPoint},
        {"RightPoint",rightPoint},
        {"TopPoint",topPoint},
        {"Motion",motionPoint},
    };

    QPen pen(Qt::red);
    this->setEditPointF(editPoints);
}

void GY_TapeFinite::updateDraw()
{
    QPointF topRightPoint = m_PropertyInfoMap["TopRightPoint"].propertyValue.value<QPointF>();//
    QPointF leftPoint = m_PropertyInfoMap["LeftPoint"].propertyValue.value<QPointF>();
    QPointF rightPoint = m_PropertyInfoMap["RightPoint"].propertyValue.value<QPointF>();
    QPointF topPoint = m_PropertyInfoMap["TopPoint"].propertyValue.value<QPointF>();
    QPointF bottomPoint = m_PropertyInfoMap["BottomPoint"].propertyValue.value<QPointF>();
    //矫正DisplayArea
    qreal leftDisplayArea = m_PropertyInfoMap["DisplayArea.Left"].propertyValue.toDouble();
    qreal bottomDisplayArea = m_PropertyInfoMap["DisplayArea.Bottom"].propertyValue.toDouble();
    qreal rightDisplayArea = m_PropertyInfoMap["DisplayArea.Right"].propertyValue.toDouble();
    qreal topDisplayArea = m_PropertyInfoMap["DisplayArea.Top"].propertyValue.toDouble();
    leftDisplayArea = leftPoint.x();
    bottomDisplayArea = bottomPoint.y();
    rightDisplayArea = rightPoint.x();
    topDisplayArea = topPoint.y();
    m_PropertyInfoMap["DisplayArea.Left"].propertyValue = leftDisplayArea;
    m_PropertyInfoMap["DisplayArea.Bottom"].propertyValue = bottomDisplayArea;
    m_PropertyInfoMap["DisplayArea.Right"].propertyValue = rightDisplayArea;
    m_PropertyInfoMap["DisplayArea.Top"].propertyValue = topDisplayArea;
    QPainterPath path;
    //给定左上角坐标、矩形宽高确定一个矩形
    QRectF rect = QRectF(topRightPoint.x(),topRightPoint.y(),leftPoint.x()-rightPoint.x(),bottomPoint.y()-topPoint.y());

    path.addRect(rect);
    graphicsPathItem->setPath(path);
    this->addToGroup(graphicsPathItem);
    QPen pen(Qt::red);
    graphicsPathItem->setZValue(0.9);//设置容器激活区域的层级
    graphicsPathItem->setPen(pen);

}

